const { defineConfig } = require('@vue/cli-service')
const { join } = require('path')
function resolve(dir) {
  return join(__dirname, dir);
}
module.exports = defineConfig({
  transpileDependencies: [
    'vuetify'
  ],
  devServer: {
    host: 'localhost',
    client: {
      overlay: false,
    },
    proxy: {
      // 配置代理转发 跨域问题
      "/user": {
        target: "http://localhost:8089",
        changeOrigin: true,
        pathRewrite: {
          '^user': ''
        }
      },
      "/student": {
        target: "http://localhost:8089",
        changeOrigin: true,
        pathRewrite: {
          '^student': ''
        }
      },
      "/teacher": {
        target: "http://localhost:8089",
        changeOrigin: true,
        pathRewrite: {
          '^teacher': ''
        }
      },
      "/evaluation": {
        target: "http://localhost:8089",
        changeOrigin: true,
        pathRewrite: {
          '^evaluation': ''
        }
      },
      "/overWeight": {
        target: "http://localhost:8089",
        changeOrigin: true,
        pathRewrite: {
          '^overWeight': ''
        }
      },
      "/recommend": {
        target: "http://localhost:8089",
        changeOrigin: true,
        pathRewrite: {
          '^recommend': ''
        }
      },
      "/supervisor": {
        target: "http://localhost:8089",
        changeOrigin: true,
        pathRewrite: {
          '^supervisor': ''
        }
      }
    }
  },
  chainWebpack: config => {
    config.module
      .rule('svg')
      .exclude.add(resolve('src/assets/icons'))
      .end()
    config.module
      .rule('icons')
      .test(/\.svg$/)
      .include.add(resolve('src/assets/icons'))
      .end()
      .use('svg-sprite-loader')
      .loader('svg-sprite-loader')
      .options({
        symbolId: 'icon-[name]'
      })
      .end()
  }

})
